#!/usr/bin/env bash

SCRIPT_ABS_PATH=$(readlink -f "$0")
SCRIPT_ABS_DIR=$(dirname $SCRIPT_ABS_PATH)

HIGHEST_TAG=`git ls-remote --tags | awk -F"/" '{print $3}' | grep '^v[0-9]*\.[0-9]*\.[0-9]*' | grep -v {} | sort --version-sort | tail -n1`
echo $HIGHEST_TAG > "$SCRIPT_ABS_DIR/cpg-version"
echo $HIGHEST_TAG
